var mapp = angular.module("myapp", []);
mapp.controller('register.ctrl', ['$scope', '$http', function ($scope, $http) {
    $scope.codeCheck = true;
    $scope.err=false;
    $scope.success=false;
    $scope.CheckAgree = function () {
        if ($scope.agreeDoc == 'Yes') {
            $scope.codeCheck = false;
        } else {
            $scope.codeCheck = true;
        }
    };
    $scope.doRegister = function () {
        var userList = {
            username: $scope.username,
            password: $scope.password,
            name: $scope.name,
            email: $scope.email,
            phone: $scope.phone,
            message: $scope.message
        };
        $http({
            url: '/user/register',
            method: 'post',
            data: userList
        }).then(function (res) {
            if (res.data.msg=='success'){
                $scope.err=false;
                $scope.success=true;
                setInterval(function () {
                    location.href='login.html'
                },300)
            }else {
                $scope.err=true;
                $scope.success=false;
            }
        })
    }
}]);
$(function () {
    $('.codeinput').blur(function () {
        if ($(this).val() == $('#code').val()) {
            $('main form .ver .fa-check').css('display', 'inline-block');
            $('main form .ver .fa-times').css('display', 'none');
        } else {
            $('main form .ver .fa-check').css('display', 'none');
            $('main form .ver .fa-times').css('display', 'inline-block');
        }
    });
    $(".row").click(function () {
        $(this).css({"borderColor": "skyblue"});
    }).mouseout(function () {
        $(this).css({"borderColor": "#cccccc"});
    });
});



